import request from '@/utils/request'

// export function login(data) {
//   return request({
//     url: '/user/login',
//     method: 'post',
//     data
//   })
// }

export function getInfo(token) {
  return request({
    url: '/maodou-user/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/maodou-user/user/logout',
    method: 'post'
  })
}

export function getList(params) {
  return request({
    // baseURL:'http://localhost:8081',
    url: '/maodou-user/user/list',
    method: 'post',
    headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
    timeout: 15000,
    responseType: 'json',
    data: params
  })
}


export function login(params) {
  return request({
    // baseURL:'http://localhost:8081',
    url: '/maodou-user/user/login',
    method: 'post',
    headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
    timeout: 15000,
    responseType: 'json',
    data: params
  })
}

export function getUserRouters(userId) {
  return request({
    // baseURL:'http://localhost:8081',
    url: `/maodou-user/user/routers/${userId}`,
    method: 'get',
    headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
    timeout: 15000,
    responseType: 'json',
    // data: params
  })
}

export function addUser(params) {
  return request({
    // baseURL:'http://localhost:8081',
    url: '/maodou-user/user/add',
    method: 'post',
    headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
    timeout: 15000,
    responseType: 'json',
    data: params
  })
}

export function editUser(params) {
  return request({
    // baseURL:'http://localhost:8081',
    url: '/maodou-user/user/edit',
    method: 'post',
    headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
    timeout: 15000,
    responseType: 'json',
    data: params
  })
}

export function deleteUsers(params) {
  return request({
    // baseURL:'http://localhost:8081',
    url: '/user/delete',
    method: 'post',
    headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
    timeout: 15000,
    responseType: 'json',
    data: params
  })
}